package com.whmskj.xjlhsc.mobie.equipmentManage.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.whmskj.xjlhbc.db.DataSource;
import com.whmskj.xjlhbc.db.DataSourceType;
import com.whmskj.xjlhbc.domain.DictionaryProcess;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.entity.Sb02EquipmentCounterAccount;
import com.whmskj.xjlhsc.mobie.equipmentManage.entity.vo.JtListVo;
import com.whmskj.xjlhsc.mobie.equipmentManage.service.DictionaryProcessService;
import com.whmskj.xjlhsc.service.Sb02EquipmentCounterAccountService;
import com.whmskj.xjlhsc.view.entity.vo.StateVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 张
 * @version 1.0
 */

@SaIgnore
@RestController
@RequestMapping("/mob/jtKb")
@Slf4j
@RequiredArgsConstructor
@Tag(description = "工作台", name = "工作台")
public class JtKbController {

    @Autowired
    private DictionaryProcessService dictionaryProcessService;

    @Autowired
    private Sb02EquipmentCounterAccountService sb02EquipmentCounterAccountService;
//    @Autowired
//    private
    @GetMapping("/process")
    @Operation(description = "获取工序")
    public Result process() {
       List<DictionaryProcess> list= dictionaryProcessService.process();
       return Result.success(list);
    }

    @GetMapping("jtState")
    @Operation(description = "机台状态")
    public Result jtState(@RequestParam(required = false) String process) {
       List<StateVo> list = sb02EquipmentCounterAccountService.jtState(process);
       return Result.success(list);
    }
    @GetMapping("jtList")
    @Operation(description = "机台数")
    public Result jtList(@RequestParam String process,
                           @RequestParam(required = false) String state,
                           @RequestParam(required = false) String keyWord) {
        Map<String,Object> map = sb02EquipmentCounterAccountService.jtList(process,state,keyWord);
      return Result.success(map);
    }



}
